home *** CD-ROM | disk | FTP | other *** search
/ HamCall (April 1991) / HAMCALL CD-ROM (Buckmaster)(April 1991).BIN / prgming / ctutor / intro.txt < prev    next >
Text File  |  1990-10-14  |  7KB  |  174 lines

  1.  
  2.                                 Introduction to the C Tutorial
  3.  
  4.  
  5.  
  6.  
  7. C IS USUALLY FIRST
  8. ______________________________________________________________
  9.  
  10. The programming language C, was originally developed by Dennis
  11. Ritchie of Bell Laboratories and was designed to run on a
  12. PDP-11 with a UNIX operating system.  Although it was
  13. originally intended to run under UNIX, there has been a great
  14. interest in running it under the MS-DOS operating system and
  15. specifically on the IBM PC and compatibles.  It is an
  16. excellent language for this environment because of the
  17. simplicity of expression, the compactness of the code, and the
  18. wide range of applicability.  Also, due to the simplicity and
  19. ease of writing a C compiler, it is usually the first high
  20. level language available on any new computer, including
  21. microcomputers, minicomputers, and mainframes.
  22.  
  23. It is not a good "beginning" language because it is somewhat
  24. cryptic in nature.  It allows the programmer a wide range of
  25. operations from high level down to a very low level,
  26. approaching the level of assembly language.  There seems to
  27. be no limit to the flexibility available.  One experienced C
  28. programmer made the statement, "You can program anything in
  29. C", and the statement is well supported by my own experience
  30. with the language.  Along with the resulting freedom however,
  31. you take on a great deal of responsibility because it is very
  32. easy to write a program that destroys itself due to the silly
  33. little errors that a good Pascal compiler will flag and call
  34. a fatal error.  In C, you are very much on your own as you
  35. will soon find.
  36.  
  37.  
  38. I ASSUME YOU KNOW A LITTLE PROGRAMMING
  39. ______________________________________________________________
  40.  
  41. Since C is not a beginners language, I will assume you are not
  42. a beginning programmer, and I will not attempt to bore you by
  43. defining a constant and a variable.  You will be expected to
  44. know these basic concepts.  You will, however, be expected to
  45. know nothing of the C programming language.  I will begin with
  46. the most basic concepts of C and take you up to the highest
  47. level of C programming including the usually intimidating
  48. concepts of pointers, structures, and dynamic allocation.  To
  49. fully understand these concepts, it will take a good bit of
  50. time and work on your part because they not particularly easy
  51. to grasp, but they are very powerful tools.  Enough said about
  52. that, you will see their power when we get there, just don't
  53. allow yourself to worry about them yet.
  54.  
  55. Programming in C is a tremendous asset in those areas where
  56. you may want to use Assembly Language but would rather keep
  57. it a "simple to write" and "easy to maintain" program.  It has
  58.  
  59.                                                            I-1
  60.  
  61.                                              Introduction to C
  62.  
  63. been said that a program written in C will pay a premium of
  64. a 20 to 50% increase in runtime because no high level language
  65. is as compact or as fast as Assembly Language.  However, the
  66. time saved in coding can be tremendous, making it the most
  67. desirable language for many programming chores.  In addition,
  68. since most programs spend 90 percent of their operating time
  69. in only 10 percent or less of the code, it is possible to
  70. write a program in C, then rewrite a small portion of the code
  71. in Assembly Language and approach the execution speed of the
  72. same program if it were written entirely in Assembly Language.
  73.  
  74. Even though the C language enjoys a good record when programs
  75. are transported from one implementation to another, there are
  76. differences in compilers as you will find anytime you try to
  77. use another compiler.  Most of the differences become apparent
  78. when you use nonstandard extensions such as calls to the DOS
  79. BIOS when using MS-DOS, but even these differences can be
  80. minimized by careful choice of programming means.
  81.  
  82. Throughout this tutorial, every attempt will be made to
  83. indicate to you what constructs are available in every C
  84. compiler because they are part of the accepted standard of
  85. programming practice.
  86.  
  87.  
  88. YOU MAY NEED A LITTLE HELP
  89. ______________________________________________________________
  90.  
  91. Modern C compilers are very capable systems, but due to the
  92. tremendous versatility of a C compiler, it could be very
  93. difficult for you to learn how to use it effectively.  If you
  94. are a complete novice to programming, you will probably find
  95. the installation instructions somewhat confusing.  You may be
  96. able to find a colleague or friend that is knowledgeable about
  97. computers to aid you in setting up your compiler for use.
  98.  
  99. This tutorial cannot cover all aspects of programming in C,
  100. simply because there is too much to cover, but it will
  101. instruct you in all you need for the majority of your
  102. programming in C.  You will receive instruction in all of the
  103. programming constructs in C, but what must be omitted are
  104. methods of programming since these can only be learned by
  105. experience.  More importantly, it will teach you the
  106. vocabulary of C so that you can go on to the more advanced
  107. techniques of using the programming language C.  A diligent
  108. effort on your part to study the material presented in this
  109. tutorial will result in a solid base of knowledge of the C
  110. programming language.  You will then be able to intelligently
  111. read technical articles or other textbooks on C and greatly
  112. expand your knowledge of this modern and very popular
  113. programming language.
  114.  
  115.  
  116.  
  117.                                                            I-2
  118.  
  119.                                              Introduction to C
  120.  
  121. HOW TO USE THIS TUTORIAL
  122. ______________________________________________________________
  123.  
  124. This tutorial was originally written in such a way that the
  125. student would sit before his computer and study each example
  126. program by displaying it on the monitor and reading the text
  127. which corresponds to that program.  Following his study of
  128. each program, he would then compile and execute it and observe
  129. the results of execution with his compiler.  This enables the
  130. student to gain experience using his compiler while he is
  131. learning the C programming language.  It is strongly
  132. recommended that the student study each example program in the
  133. given sequence then write the programs suggested at the end
  134. of each chapter in order to gain experience in writing C
  135. programs.
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.                                                            I-3
  173.  
  174.